home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / bsrc_p1.arc / B_PASSWO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-11-30  |  5.0 KB  |  119 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*               The Opus Computer-Based Conversation System                */
  3. /*       (c) Copyright 1987, Wynn Wagner III, All Rights Reserved           */
  4. /*                                                                          */
  5. /*                   YOOHOO is a trademark of Wynn Wagner III               */
  6. /*                                                                          */
  7. /*                            YOOHOO-YOOHOO/2U2 is                          */
  8. /*           Copyright 1987, Wynn Wagner III, All Rights Reserved           */
  9. /*                                                                          */
  10. /*                                                                          */
  11. /*                      BinkleyTerm Password Processor                      */
  12. /*                                                                          */
  13. /*                                                                          */
  14. /*  This module is a very simple FOSSIL-based terminal emulator. It is      */
  15. /*  provided for your information only.  You will find routines that need   */
  16. /*  to be coded and identifiers to be resolved. It has been previously      */
  17. /*  known as "OpusLink" and "OConnect". The use of the name "BinkleyTerm"   */
  18. /*  does not preclude the possibility that another "OpusLink" or "OConnect" */
  19. /*  could be released.                                                      */
  20. /*                                                                          */
  21. /*  There is absolutely no guarantee that anything here will work.  If you  */
  22. /*  break this routine, you own both pieces.                                */
  23. /*                                                                          */
  24. /*  USAGE:  You may use this material in any program with no obligation     */
  25. /*          as long as there is no charge for your program.  For more       */
  26. /*          information about commercial use, contact the "OPUSinfo HERE"   */
  27. /*          BBS (124/111).                                                  */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /*--------------------------------------------------------------------------*/
  31.  
  32. #include <signal.h>
  33. #include <ctype.h>
  34. #include <conio.h>
  35.  
  36. #define WAZOO_SECTION
  37. #include "zmodem.h"
  38.  
  39. #include "com.h"
  40.  
  41. static char *snitty_message = "Sorry, Charlie.";
  42.  
  43. /*--------------------------------------------------------------------------*/
  44. /* N PASSWORD                                                               */
  45. /*--------------------------------------------------------------------------*/
  46. n_password( theirs, ours )
  47.    char *theirs;
  48.    char *ours;
  49.    begin
  50.       if (theirs[0])
  51.          begin
  52.             fancy_str( theirs );
  53.             fancy_str( ours   );
  54.  
  55.             if (strnicmp(theirs,ours,6))
  56.                begin
  57.                   register int i;
  58.  
  59.                    status_line( "!Pwd Err (%d/%d): %s/%s",
  60.                               remote_net,
  61.                               remote_node,
  62.                               theirs,
  63.                               ours
  64.                             );
  65.  
  66.                   SENDCHARS (snitty_message, strlen (snitty_message), 0);
  67.  
  68.                   while (!OUT_EMPTY())
  69.                      time_release();
  70.  
  71.                   return 1;
  72.                end
  73.             
  74.             status_line("*Password-protected session");
  75.             strncpy(theirs,ours,8);
  76.             theirs[6] = '\0';
  77.          end
  78.  
  79.       return 0;
  80.  
  81.    end
  82.  
  83.  
  84. /*--------------------------------------------------------------------------*/
  85. /* N GET PASSWORD                                                           */
  86. /* Find the nodelist entry for this system and point remote_password at     */
  87. /* its password if any                                                      */
  88. /*--------------------------------------------------------------------------*/
  89. n_getpassword(net,node)
  90. int net,node;
  91. {
  92. int limit;
  93. char *c;
  94. extern char *remote_password;
  95. extern struct _node nodedes;            /* desc. of node            */
  96. if (( net != nodedes.net)            /* If we don't have it yet  */
  97. || (node != nodedes.number))            /* we'll have to get it ... */
  98.     {
  99.     if (!nodefind(net,node))        /* find the node in the list*/
  100.       {
  101.       remote_password = NULL;
  102.         return(0);            /* return failure if can't  */
  103.       }
  104.     }
  105. c = nodedes.city;                /* Point to start of city   */
  106. limit = 37;                    /* No password if this = 0  */
  107. while (limit--)                    /* Enforce that limit       */
  108.     {
  109.     if (*c++ != '\0')            /* If not at end of city,   */
  110.         continue;            /* go on to next character  */
  111.     if (*c++ != '!')            /* End of city, got '!' ??  */
  112.         break;                /* No, treat like a failure */
  113.     remote_password = c;            /* Got it, point to it      */
  114.     return(1);                /* Exit with success code   */
  115.     }
  116. remote_password = NULL;                /* No password, say that    */
  117. return(1);                    /* Successful attempt       */
  118. }
  119.